<template>
  <div>
    <el-table v-loading="loading" :data="list">
      <el-table-column label="用户姓名" align="center">
        <template slot-scope="scope">{{
          scope.row.dataPoolUser.userName
        }}</template>
      </el-table-column>
      <el-table-column label="用户手机号" align="center">
        <template slot-scope="scope">
          {{ scope.row.dataPoolUser.userPhone }}
        </template>
      </el-table-column>
      <el-table-column label="微信openId" align="center">
        <template slot-scope="scope">
          {{ scope.row.dataPoolUser.userWxOpenId }}
        </template>
      </el-table-column>
      <el-table-column label="nhOpenId" align="center">
        <template slot-scope="scope">
          {{ scope.row.dataPoolUser.userNhOpenId }}
        </template>
      </el-table-column>
      <el-table-column label="用户状态" align="center">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.dataPoolUser.userStatus == 1"
            >正常</el-tag
          >
          <el-tag type="danger" v-if="scope.row.dataPoolUser.userStatus == 0"
            >不正常</el-tag
          >
        </template>
      </el-table-column>

      <el-table-column label="是否白名单用户" align="center">
        <template slot-scope="scope">
          <el-tag type="warng" v-if="scope.row.dataPoolUser.isWrite == 1"
            >是</el-tag
          >
          <el-tag type="success" v-if="scope.row.dataPoolUser.isWrite == 0"
            >否</el-tag
          >
        </template>
      </el-table-column>
      <el-table-column label="用户标识类别" align="center">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.dataPoolUser.userUniqueType == 1"
            >手机号</el-tag
          >
          <el-tag v-if="scope.row.dataPoolUser.userUniqueType == 2"
            >微信openId</el-tag
          >
          <el-tag v-if="scope.row.dataPoolUser.userUniqueType == 3"
            >掌银openId</el-tag
          >
          <el-tag v-if="scope.row.dataPoolUser.userUniqueType == 4"
            >手机号+wxOpenId</el-tag
          >
          <el-tag v-if="scope.row.dataPoolUser.userUniqueType == 5"
            >nh手机号+nhOpenId</el-tag
          >
        </template>
      </el-table-column>
      <el-table-column label="加白时间" align="center">
        <template slot-scope="scope">
          {{ scope.row.dataPoolUser.addWriteTime }}
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script>
import { searchInfo } from "@/api/operation/operationSearch";
export default {
  name: "UserList",
  props: {
    loading: {
      type: Boolean,
      default: false,
    },
    queryParams: {
      type: Object,
      default: () => ({
        pageNum: 1,
        pageSize: 10,
      }),
    },
    total: {
      type: Number,
      default: 0,
    },
    //搜索的条件
    dataPoolDTO: {
      type: Object,
    },
    //订单列表
    list: {
      type: Array,
    },
  },
  methods: {
    /** 查询用户列表 */
    getList() {
      this.$emit("update:loading", true);

      searchInfo({
        dataPoolDTO: {
          ...this.dataPoolDTO,
          ...this.queryParams,
          searchType: 1,
        },
      }).then((response) => {
        this.$emit("update:list", response.rows);
        this.$emit("update:total", response.total);
        this.$emit("update:loading", false);
      });
    },
  },
};
</script>
